package com.hxs.learn.entity.core;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldStrategy;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hxs.learn.common.entity.BaseEntity;
import lombok.*;
import org.apache.ibatis.type.Alias;

import java.util.Date;
import java.util.List;


/**
 * @author huxinsheng
 * @date 2018-04-24 15:32:13
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "sys_menu")
@Alias(value = "SysMenu")
public class SysMenu implements BaseEntity {
    /**
     * 编号
     */
    @TableId(value = "id", type = IdType.INPUT)
    private String id;
    /**
     * 菜单排序
     */
    @TableField(value = "seq")
    private Integer seq;
    /**
     * 创建人
     */
    @TableField(value = "creator", strategy = FieldStrategy.NOT_EMPTY)
    private String creator;
    /**
     * 菜单图标
     */
    @TableField(value = "icon", strategy = FieldStrategy.NOT_EMPTY)
    private String icon;
    /**
     * 菜单名称
     */
    @TableField(value = "name", strategy = FieldStrategy.NOT_EMPTY)
    private String name;
    /**
     * 父菜单名称
     */
    @TableField(value = "parentName", strategy = FieldStrategy.NOT_EMPTY)
    private String parentName;
    /**
     * 父编号 所有一级菜单的父菜单ID都为0
     */
    @TableField(value = "pid", strategy = FieldStrategy.NOT_EMPTY)
    private String pid;
    /**
     * 更新人
     */
    @TableField(value = "updateBy", strategy = FieldStrategy.NOT_EMPTY)
    private String updateBy;
    /**
     * 菜单地址
     */
    @TableField(value = "url", strategy = FieldStrategy.NOT_EMPTY)
    private String url;
    /**
     * 菜单视图
     */
    @TableField(value = "view", strategy = FieldStrategy.NOT_EMPTY)
    private String view;
    /**
     * 创建时间
     */
    @TableField(value = "createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    /**
     * 更新时间
     */
    @TableField(value = "updateTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 子菜单列表
     */
    @TableField(exist = false)
    private List<SysMenu> subMenus;

    /***
     * 是否选中
     **/
    @TableField(exist = false)
    private boolean checked;
}
